package com.carrey.cms_1810.entity;

import java.io.Serializable;
import java.util.Date;

import org.springframework.format.annotation.DateTimeFormat;

import com.carrey.carrey_utils.util.DateUtil;


/**
 * 
 * @author Carre
 *
 */
public class Article implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private Integer id;//
	// 标题
	private String title;
	// 文章内容
	private String content;
	// 标题图片
	private String picture;
	// 所属栏目
	private Integer channelId;
	// 所属分类
	private Integer categoryId;
	// 文章发布人
	private Integer userId;
	// 点击量
	private Integer hits;
	// 是否热门
	private Integer hot;
	// 0,刚发布,1审核通过,-1 审核未通过
	private Integer status;
	// 0:正常,1:删除
	private Integer deleted;
	// 创建时间
	@DateTimeFormat(pattern = "yyyy-MM-dd  HH:mm:ss")
	private Date created;
	// 修改时间
	private Date updated;
	// 摘要
	private String summary;
	// 文章类型: 0:html 1:json
	private Integer contentType;
	// 关键字
	private String keywords;
	// 文章来源
	private String original;
	// 评论数量
	private Integer comments;
	//频道
	private String channelName;
	//分类
	private String categoryName;
	//用户
	private String userName;
	
	//人性化时间(数据库忽略字段)
	private String displayTime;
	
	// 调用工具类，计算人性化时间
	public String getDisplayTime() {
		if(created != null) {
			displayTime = DateUtil.getDisplayTime(created);
		}
		return displayTime;
	}
	public void setDisplayTime(String displayTime) {
		this.displayTime = displayTime;
	}
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public String getPicture() {
		return picture;
	}
	public void setPicture(String picture) {
		this.picture = picture;
	}
	public Integer getChannelId() {
		return channelId;
	}
	public void setChannelId(Integer channelId) {
		this.channelId = channelId;
	}
	public Integer getCategoryId() {
		return categoryId;
	}
	public void setCategoryId(Integer categoryId) {
		this.categoryId = categoryId;
	}
	public Integer getUserId() {
		return userId;
	}
	public void setUserId(Integer userId) {
		this.userId = userId;
	}
	public Integer getHits() {
		return hits;
	}
	public void setHits(Integer hits) {
		this.hits = hits;
	}
	public Integer getHot() {
		return hot;
	}
	public void setHot(Integer hot) {
		this.hot = hot;
	}
	public Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	public Integer getDeleted() {
		return deleted;
	}
	public void setDeleted(Integer deleted) {
		this.deleted = deleted;
	}
	public Date getCreated() {
		return created;
	}
	public void setCreated(Date created) {
		this.created = created;
	}
	public Date getUpdated() {
		return updated;
	}
	public void setUpdated(Date updated) {
		this.updated = updated;
	}
	public String getSummary() {
		return summary;
	}
	public void setSummary(String summary) {
		this.summary = summary;
	}
	public Integer getContentType() {
		return contentType;
	}
	public void setContentType(Integer contentType) {
		this.contentType = contentType;
	}
	public String getKeywords() {
		return keywords;
	}
	public void setKeywords(String keywords) {
		this.keywords = keywords;
	}
	public String getOriginal() {
		return original;
	}
	public void setOriginal(String original) {
		this.original = original;
	}
	public Integer getComments() {
		return comments;
	}
	public void setComments(Integer comments) {
		this.comments = comments;
	}
	public String getChannelName() {
		return channelName;
	}
	public void setChannelName(String channelName) {
		this.channelName = channelName;
	}
	public String getCategoryName() {
		return categoryName;
	}
	public void setCategoryName(String categoryName) {
		this.categoryName = categoryName;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	
	public Article() {
		super();
		// TODO Auto-generated constructor stub
	}
	public Article(Integer id, String title, String content, String picture, Integer channelId, Integer categoryId,
			Integer userId, Integer hits, Integer hot, Integer status, Integer deleted, Date created, Date updated,
			String summary, Integer contentType, String keywords, String original, Integer comments, String channelName,
			String categoryName, String userName, String displayTime) {
		super();
		this.id = id;
		this.title = title;
		this.content = content;
		this.picture = picture;
		this.channelId = channelId;
		this.categoryId = categoryId;
		this.userId = userId;
		this.hits = hits;
		this.hot = hot;
		this.status = status;
		this.deleted = deleted;
		this.created = created;
		this.updated = updated;
		this.summary = summary;
		this.contentType = contentType;
		this.keywords = keywords;
		this.original = original;
		this.comments = comments;
		this.channelName = channelName;
		this.categoryName = categoryName;
		this.userName = userName;
		this.displayTime = displayTime;
	}
	@Override
	public String toString() {
		return "Article [id=" + id + ", title=" + title + ", content=" + content + ", picture=" + picture
				+ ", channelId=" + channelId + ", categoryId=" + categoryId + ", userId=" + userId + ", hits=" + hits
				+ ", hot=" + hot + ", status=" + status + ", deleted=" + deleted + ", created=" + created + ", updated="
				+ updated + ", summary=" + summary + ", contentType=" + contentType + ", keywords=" + keywords
				+ ", original=" + original + ", comments=" + comments + ", channelName=" + channelName
				+ ", categoryName=" + categoryName + ", userName=" + userName + ", displayTime=" + displayTime + "]";
	}
	

	
}
